﻿using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using UnitLibrary.GameObjects.Physics;
using UnitLibrary.Managers;

namespace UnitLibrary.GameObjects.Units
{
    public class UnitGen: PhyObj
    {
        #region Properties and Values

        public int Health;
        public int Damage;
        public int Range;
        public double AttackRate;
       
        #endregion

        #region IGameObject
        
        public override void Create(object genericUnit, ComponentM components, Vector2 location, Vector2 direction, bool addtophysics)
        { 
            base.Create(genericUnit, components, location, direction, addtophysics);
            CopyValues((UnitGen)genericUnit);            
        }

        protected void CopyValues(UnitGen _genericUnit)
        {
            this.Health = _genericUnit.Health;
            this.Damage = _genericUnit.Damage;
            this.Range = _genericUnit.Range;
            this.AttackRate = _genericUnit.AttackRate;
            this.MoveSpeed = _genericUnit.MoveSpeed;
        }

        protected void AddValues(UnitGen _genericUnit)
        {
            this.Health += _genericUnit.Health;
            this.Damage += _genericUnit.Damage;
            this.Range += _genericUnit.Range;
            this.AttackRate += _genericUnit.AttackRate;
            this.MoveSpeed += _genericUnit.MoveSpeed;
        }

        protected void SubtractValues(UnitGen _genericUnit)
        {
            this.Damage -= _genericUnit.Damage;
            this.Range -= _genericUnit.Range;
            this.AttackRate -= _genericUnit.AttackRate;
            this.MoveSpeed -= _genericUnit.MoveSpeed;
        }
        #endregion
        //public override void ReadContent(ContentReader input)
        //{
        //    base.ReadContent(input);
        //    this.Unitid = input.ReadObject<UnitID>();
        //    this.Health = input.ReadInt32();
        //    this.Damage = input.ReadInt32();
        //    this.Range = input.ReadInt32();
        //    this.AttackRate = input.ReadDouble();
        //    this.MoveSpeed = input.ReadSingle();
        //    base._moveSpeed = this.MoveSpeed;
        //}
    }
}
